<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorate="layout">
<head>
    <title>home</title>
</head>
<body>
<!--<h1 layout:fragment="header">Messages : View all</h1>-->
<div layout:fragment="content">
    <div class="box-header with-border">
        <h3 class="box-title">用户管理</h3>
    </div>
    <!-- /.box-header -->
    <!-- form start -->
    <form class="form-horizontal" role="form">
        <div class="box-body">
            <div class="form-group col-md-3">
                <label for="search_account" class="col-sm-4 control-label">用户登录名</label>

                <div class="col-xs-8 no-padding">
                    <input type="text" id="search_account" class="form-control" placeholder="用户登录名" name="search_account">
                </div>
            </div>
            <div class="form-group col-md-3">
                <label for="search_username" class="col-sm-4 control-label">用户性名</label>

                <div class="col-xs-8 no-padding">
                    <input type="text" id="search_username" class="form-control" placeholder="用户性名(模糊查询)" name="search_username">
                </div>
            </div>
            <div class="form-group col-md-3">
                <label for="search_type" class="col-sm-4 control-label">状态</label>

                <div class="col-xs-8 no-padding">
                    <select id="search_type" class="form-control" name="search_type">
                        <option value="0">--全部--</option>
                        <option value="1">作废</option>
                        <option value="2">锁定</option>
                        <option value="3">启用</option>
                    </select>
                </div>
            </div>
            <div class="form-group col-md-3 right-button">
                <button onclick="searchAccount()" type="button" class="btn btn-danger right-button">查询</button>
                <button onclick="addAccount()" type="button" class="btn btn-success right-button">新增</button>
            </div>
        </div>
    </form>
    <div class="box-body">
        <table id="account" class="table table-bordered table-striped">
            <thead>
            <tr>
                <th>序号</th>
                <th>用户登录名</th>
                <th>用户姓名</th>
                <th>联系电话</th>
                <th>传真</th>
                <th>状态</th>
                <th>用户组</th>
                <th>更新时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
    <div class="modal" id="accountModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span></button>
                    <h3 class="modal-title" style="font-size:18px;">用户添加</h3>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="accountForm">
                        <div class="box-body">
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="accountName" class="col-sm-4 control-label">用户登录名</label>

                                        <div class="col-sm-8">
                                            <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
                                            <input type="text" class="form-control" id="accountName" data-rule="required(用户登录名必须填写)" name="accountName" placeholder="用户登录名">
                                            <input type="hidden" id="id" name="id">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="username" class="col-sm-4 control-label">用户性名</label>

                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="username" data-rule="required(用户性名必须填写)" name="username" placeholder="用户性名">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="add_status" class="col-sm-4 control-label">状态</label>

                                        <div class="col-sm-8">
                                            <select id="add_status" class="form-control" name="status">
                                                <option value="0">无状态</option>
                                                <option value="1">作废</option>
                                                <option value="2">锁定</option>
                                                <option value="3">启用</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="phone" class="col-sm-4 control-label">联系电话</label>

                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="phone" name="phone" placeholder="联系电话">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="fax" class="col-sm-4 control-label">传真</label>

                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="fax" name="fax" placeholder="传真">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="rolename" class="col-sm-4 control-label">用户组</label>

                                        <div class="col-sm-8">
                                            <select id="rolename" class="form-control" name="rolename">
                                                <option value="0">无用户组</option>
                                                <option th:each="item:${roles}" th:value="${item.id}" th:text="${item.roleName}"></option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" onclick="account_sub()">
                        确认
                    </button>
                    <button class="btn btn-warning" data-dismiss="modal">退出</button>
                </div>
            </div>
        </div><!-- /.modal -->
    </div>
    <script src="../../static/js/pages/account.js"></script>
</div>
</body>
</html>
